package com.wk1un2.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.wk1un2.service.UsersrolesService;
import com.wk1un2.util.Result;

@RequestMapping("/public")
@RestController
public class UsersrolesController {
	@Autowired
	private UsersrolesService usersrolesservice;

	@RequestMapping("/getAllUsersroles")
	public Object getAll(@RequestParam Map<String, Object> map) {
		Integer page = Integer.parseInt(map.get("page").toString());
		Integer limit = Integer.parseInt(map.get("limit").toString());
		map.put("page", (page - 1) * limit);
		map.put("limit", limit);
		Result res = new Result(0, "", usersrolesservice.count(map), usersrolesservice.getAllUsersroles(map));
		return res;
	}

}
